
const _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault');

exports.__esModule = true;
exports.default = void 0;

const _babelHelperVueJsxMergeProps = _interopRequireDefault(require('@vue/babel-helper-vue-jsx-merge-props'));

const _utils = require('../../utils');

const _functional = require('../../utils/functional');

const _button = _interopRequireDefault(require('../../button'));

// Utils
// Components
const _createNamespace = (0, _utils.createNamespace)('sku-actions');
const createComponent = _createNamespace[0];
const bem = _createNamespace[1];
const t = _createNamespace[2];

function SkuActions(h, props, slots, ctx) {
  const createEmitter = function createEmitter(name) {
    return function () {
      props.skuEventBus.$emit(name);
    };
  };

  return h('div', (0, _babelHelperVueJsxMergeProps.default)([{
    class: bem(),
  }, (0, _functional.inherit)(ctx)]), [props.showAddCartBtn && h(_button.default, {
    attrs: {
      size: 'large',
      type: 'warning',
      text: props.addCartText || t('addCart'),
    },
    on: {
      click: createEmitter('sku:addCart'),
    },
  }), h(_button.default, {
    attrs: {
      size: 'large',
      type: 'danger',
      text: props.buyText || t('buy'),
    },
    on: {
      click: createEmitter('sku:buy'),
    },
  })]);
}

SkuActions.props = {
  buyText: String,
  addCartText: String,
  skuEventBus: Object,
  showAddCartBtn: Boolean,
};

const _default = createComponent(SkuActions);

exports.default = _default;
